package com.liziba.rpc;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @auther LiZiBa
 * @date 2020/10/19 21:52
 * @description: 客户端动态代理
 **/
public class RpcClientProxy {

    // JDK cglib javasisst asm
    public <T> T cilentProxy(final Class<T> interfaceClazz, String host, int port) {

        return (T) Proxy.newProxyInstance(interfaceClazz.getClassLoader(), new Class<?>[]{interfaceClazz} , new RemoteInvocationHandler(host, port));
    }
}
